import { createApp } from 'vue'
import './scss/style.scss'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import dayjs from 'dayjs';
import updateLocale from 'dayjs/plugin/updateLocale';
import { createPinia } from 'pinia'
import 'element-plus/dist/index.css'
import eventBus from './eventBus.js';
import { createI18n } from 'vue-i18n'
import './mock'
import 'dayjs/locale/zh-cn'
import { use } from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers';
import { PieChart, LineChart, BarChart } from 'echarts/charts'; // 按需引入图表类型
import { TitleComponent, TooltipComponent, LegendComponent, GridComponent, ToolboxComponent } from 'echarts/components'; // 按需引入组件
import VChart from 'vue-echarts';

use([CanvasRenderer, PieChart, LineChart, BarChart, TitleComponent, TooltipComponent, LegendComponent, GridComponent, ToolboxComponent]);

const i18n = createI18n({ locale: 'zh-cn' })
// 配置 dayjs 的每周第一天为星期一
dayjs.extend(updateLocale);
dayjs.updateLocale('zh-cn', {
  weekStart: 1, // 1 表示星期一
});

// vue-cropper 截图插件
window.addEventListener('resize', () => {
  console.log('windowResized');
  eventBus.emit('windowResized');
});
const app = createApp(App)
app.component('v-chart', VChart)
app.use(ElementPlus, {
  locale: zhCn,
})
  .use(i18n)
  .use(router)
  .use(createPinia())
  .mount('#app')
